home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / shells / bashsrc.zoo / variables.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-05  |  1.8 KB  |  42 lines

  1. /* variables.h -- data structures for shell variables. */
  2.  
  3. /* What a shell variable looks like. */
  4. typedef struct variable {
  5.   struct variable *next;    /* Next variable in the list. */
  6.   char *name;            /* Symbol that the user types. */
  7.   char *value;            /* Value that is returned. */
  8.   char *function;        /* Function cell. */
  9.   int attributes;        /* export, readonly, array, invisible... */
  10.   int context;            /* Which context this variable belongs to. */
  11.   struct variable *prev_context; /* Value from previous context or NULL. */
  12. } SHELL_VAR;
  13.  
  14. /* The various attributes that a given variable can have.
  15.    We only reserve one byte of the INT. */
  16. #define att_exported  0x01    /* %00000001 (export to environment) */
  17. #define att_readonly  0x02    /* %00000010 (cannot change)         */
  18. #define att_invisible 0x04    /* %00000100 (cannot see)         */
  19. #define att_array     0x08    /* %00001000 (value is an array)     */
  20. #define att_nounset   0x10    /* %00010000 (cannot unset)         */
  21.  
  22. /* This is on the way out.  It is only here so that
  23.    set_or_show_variables () has a flag value for the "-f" flag. */
  24. #define att_function  0x20    /* %00100000 */
  25.  
  26. #define exported_p(var)        ((((var)->attributes) & (att_exported)))
  27. #define readonly_p(var)        ((((var)->attributes) & (att_readonly)))
  28. #define invisible_p(var)    ((((var)->attributes) & (att_invisible)))
  29. #define array_p(var)        ((((var)->attributes) & (att_array)))
  30. #define function_p(var)        ((((var)->function) != (char *)NULL))
  31.  
  32. #define function_cell(var) ((var)->function)
  33. #define value_cell(var) ((var)->value)
  34.  
  35. /* Stuff for hacking variables. */
  36. extern SHELL_VAR *variable_list, *bind_variable (), *find_variable ();
  37. extern SHELL_VAR *copy_variable ();
  38. extern char *get_string_value (), *dollar_vars[];
  39. extern char **export_env;
  40.  
  41. extern int variable_context;
  42.